
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')

ifneq (,$(findstring MINGW,$(uname_S)))
  include mingw.inc
else
  include linux.inc
endif

TARGETS= lpt$(EXT) array$(EXT) gl2$(EXT)


all: $(TARGETS)

lpt$(EXT): lpt_wrap.cxx
	g++ -o $@ $(SHARED) $< ../../lpt/lpt.o -I ../../lpt $(LUA_INC) $(LUA_LIB)

lpt_wrap.cxx: lpt.i ../../lpt/lpt.hpp
	swig -c++ -lua $<

array$(EXT): array_wrap.cxx 
	g++ -o $@ $(SHARED) $< $(LUA_INC) $(LUA_LIB)

array_wrap.cxx: array.i array.hpp
	swig -c++ -lua $<

gl2$(EXT): gl2_wrap.cxx 
	g++ -o $@ $(SHARED) $< $(LUA_INC) $(GL2_INC) $(LUA_LIB) $(GL2_LIB)

gl2_wrap.cxx: gl2.i gl2.hpp 
	swig -c++ -lua $<

clean:
	rm -rf $(TARGETS) 

cleanall:
	rm -rf $(TARGETS) *_wrap.cxx
